import type { MeetingForm, MeetingQuery, MeetingVO } from './model';

import type { ID, IDS, PageResult } from '#/api/common';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

/**
 * 分页查询会议列表
 * @param params
 * @returns 会议列表
 */
export function meetingPage(params?: MeetingQuery) {
  return requestClient.get<PageResult<MeetingVO>>('/meeting/page', {
    params,
  });
}

/**
 * 查询会议列表
 * @param params
 * @returns 会议列表
 */
export function meetingList(params?: MeetingQuery) {
  return requestClient.get<MeetingVO[]>('/meeting/list', { params });
}

/**
 * 导出会议列表
 * @param params
 * @returns 会议列表
 */
export function meetingExport(params?: MeetingQuery) {
  return commonExport('/meeting/export', params ?? {});
}

/**
 * 查询会议详情
 * @param id id
 * @returns 会议详情
 */
export function meetingInfo(id: ID) {
  return requestClient.get<MeetingVO>(`/meeting/${id}`);
}

/**
 * 新增会议
 * @param data
 * @returns void
 */
export function meetingAdd(data: MeetingForm) {
  return requestClient.postWithMsg<void>('/meeting', data);
}

/**
 * 更新会议
 * @param data
 * @returns void
 */
export function meetingUpdate(data: MeetingForm) {
  return requestClient.putWithMsg<void>('/meeting', data);
}

/**
 * 更新会议状态
 * @param data
 * @returns void
 */
export function meetingUpdateStatus(data: MeetingForm) {
  return requestClient.putWithMsg<void>(`/meeting/changeStatus`, data);
}

/**
 * 删除会议
 * @param id id
 * @returns void
 */
export function meetingRemove(id: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/meeting/${id}`);
}
